﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("BE")]

namespace DAL.Abastos
{
    public class MeasuresDA<T>:IDisposable
    {
        string CreateGUID = "3F03A19B-2939-4CC2-93A2-76C0FD9FFC80";
        string UpdateGUID = "C1F6DA4D-4F5A-4B69-A798-FADC2A47C7F1"; //Pendiente
        string DeleteGUID = "DD81E4D6-15EA-44EE-9713-FC33B54764A4"; //Pendiente
        string SelectGUID = "696B3AAC-68BD-4B3D-9D45-FB5CFEEE19FD";

        internal T Create(string sMeasureName)
        {
            try
            {
                T result = Activator.CreateInstance<T>();

                result = new GenericList<T>().GetAGenelicListOf(
                    DAL.Gateway.DataAccessGateway.TraerDataTable(CreateGUID, sMeasureName)).Single();

                return result;

            }
            catch (Exception ex)
            {
                throw new Exception("MeasuresDA - Create - ", ex);
            }
        }
        internal List<T> Select(int? iMeasureId, string sMeasureName)
        {
            try
            {
                List<T> result = new List<T>();

                result = new GenericList<T>().GetAGenelicListOf(
                    DAL.Gateway.DataAccessGateway.TraerDataTable(SelectGUID, iMeasureId, sMeasureName));

                return result;
            }
            catch (Exception ex)
            {
                throw new Exception("MeasuresDA - Create - ", ex);
            }
        }
        public void Dispose()
        {
        }
    }
}
